<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="DeliveryManager.aspx.cs" Inherits="Employee_DeliveryManager" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table style="width: 400px">
        <tr>
            <td colspan="3">
                <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="X-Large" Text="Delivery Manager"></asp:Label><br />
                <br />
                <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label><br />
                <table style="width: 500px">
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label2" runat="server" Text="Delivery Number" Width="50px"></asp:Label></td>
                        <td style="width: 100px">
                            <asp:TextBox ID="TextBox1" runat="server" MaxLength="50"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                                ErrorMessage="Delivery Number cannot be blank" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px; height: 21px">
                            <asp:Label ID="Label3" runat="server" Text="Customer ID"></asp:Label></td>
                        <td style="width: 100px; height: 21px">
                            <asp:TextBox ID="TextBox2" runat="server" MaxLength="50"></asp:TextBox><br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
                                ErrorMessage="CustomerID cannot be blank" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label4" runat="server" Text="Service ID"></asp:Label></td>
                        <td style="width: 100px">
                            <asp:TextBox ID="TextBox3" runat="server" MaxLength="50"></asp:TextBox><br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox3"
                                ErrorMessage="Service ID cannot be blank" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label5" runat="server" Text="Weight"></asp:Label></td>
                        <td style="width: 100px">
                            <asp:TextBox ID="TextBox4" runat="server" MaxLength="50"></asp:TextBox><br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox4"
                                ErrorMessage="Weight cannot be blank" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label6" runat="server" Text="Date of Posting"></asp:Label></td>
                        <td style="width: 100px">
                            <asp:TextBox ID="TextBox5" runat="server" MaxLength="50"></asp:TextBox><br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="TextBox5"
                                ErrorMessage="Date of Posting cannot be blank" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label7" runat="server" Text="Receive Date"></asp:Label></td>
                        <td style="width: 100px">
                            <asp:TextBox ID="TextBox6" runat="server" MaxLength="50"></asp:TextBox><br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="TextBox6"
                                ErrorMessage="Receive Date cannot be blank" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label8" runat="server" Text="Destination Address"></asp:Label></td>
                        <td style="width: 100px">
                            <asp:TextBox ID="TextBox7" runat="server" MaxLength="50"></asp:TextBox><br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="TextBox7"
                                ErrorMessage="Destination Address cannot be blank" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label9" runat="server" Text="Status"></asp:Label></td>
                        <td style="width: 100px">
                            <asp:TextBox ID="TextBox8" runat="server" MaxLength="50"></asp:TextBox><br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="TextBox8"
                                ErrorMessage="Status cannot be blank" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label10" runat="server" Text="Fee Type ID"></asp:Label></td>
                        <td style="width: 100px">
                            <asp:TextBox ID="TextBox9" runat="server" MaxLength="50"></asp:TextBox><br />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="TextBox9"
                                ErrorMessage="Fee Type ID" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                        </td>
                        <td style="width: 100px">
                            <asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Add New" /></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="3" rowspan="2">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3"
                    DataKeyNames="DeliveryNo" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Vertical"
                    OnSelectedIndexChanged="GridView1_SelectedIndexChanged" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px">
                    <Columns>
                        <asp:BoundField DataField="DeliveryNo" HeaderText="DeliveryNo" SortExpression="DeliveryNo" />
                        <asp:BoundField DataField="CustID" HeaderText="CustID" SortExpression="CustID" />
                        <asp:BoundField DataField="ServiceID" HeaderText="ServiceID" SortExpression="ServiceID" />
                        <asp:BoundField DataField="Weight" HeaderText="Weight" SortExpression="Weight" />
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" OnClick="LinkButton1_Click">Details</asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:CommandField ShowDeleteButton="True" />
                    </Columns>
                    <FooterStyle BackColor="#CCCCCC" />
                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="#CCCCCC" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Con %>"
                    DeleteCommand="DELETE FROM [Delivery] WHERE [DeliveryNo] = @DeliveryNo" InsertCommand="INSERT INTO [Delivery] ([Weight], [DateOfPosting], [ServiceID], [DestinationAddress], [CustID], [FeeTypeID], [Status], [ReceiveDate]) VALUES (@Weight, @DateOfPosting, @ServiceID, @DestinationAddress, @CustID, @FeeTypeID, @Status, @ReceiveDate)"
                    SelectCommand="SELECT * FROM [Delivery]" UpdateCommand="UPDATE [Delivery] SET [Weight] = @Weight, [DateOfPosting] = @DateOfPosting, [ServiceID] = @ServiceID, [DestinationAddress] = @DestinationAddress, [CustID] = @CustID, [FeeTypeID] = @FeeTypeID, [Status] = @Status, [ReceiveDate] = @ReceiveDate WHERE [DeliveryNo] = @DeliveryNo">
                    <DeleteParameters>
                        <asp:Parameter Name="DeliveryNo" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Weight" Type="Double" />
                        <asp:Parameter DbType="Date" Name="DateOfPosting" />
                        <asp:Parameter Name="ServiceID" Type="Int32" />
                        <asp:Parameter Name="DestinationAddress" Type="String" />
                        <asp:Parameter Name="CustID" Type="Int32" />
                        <asp:Parameter Name="FeeTypeID" Type="Int32" />
                        <asp:Parameter Name="Status" Type="Boolean" />
                        <asp:Parameter DbType="Date" Name="ReceiveDate" />
                        <asp:Parameter Name="DeliveryNo" Type="Int32" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Weight" Type="Double" />
                        <asp:Parameter DbType="Date" Name="DateOfPosting" />
                        <asp:Parameter Name="ServiceID" Type="Int32" />
                        <asp:Parameter Name="DestinationAddress" Type="String" />
                        <asp:Parameter Name="CustID" Type="Int32" />
                        <asp:Parameter Name="FeeTypeID" Type="Int32" />
                        <asp:Parameter Name="Status" Type="Boolean" />
                        <asp:Parameter DbType="Date" Name="ReceiveDate" />
                    </InsertParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
        </tr>
    </table>
</asp:Content>

